﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    Inherits="Nivdal.ForumHomePage" Title="" Theme="SkinFile" CodeBehind="ForumHomePage.aspx.cs" %>

<asp:Content ID="PageNameContent" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" Text="<%$ Resources:Resource, ForumHomePage_PageNameLabel %>"
        CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
    
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="ajaxloader">
                <asp:Image ID="ProgressImage" runat="server" ImageUrl="~/Images/ajax-loader.gif" />
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>                    
        

    <div class="basic_element">
    <div class="red_title">
        <asp:Label ID="Label1" runat="server" Text="<%$ Resources:Resource, ForumHomePage_PageNameLabel %>" CssClass="white_title"></asp:Label>
    </div>
    <div class="padding5">

        <asp:Label ID="MessageLabel" runat="server" Text="" SkinID="GreenSmallHeaderLabel"></asp:Label>
        <asp:FormView ID="ForumGlobalStatisticsFormView" runat="server" DataSourceID="ForumGlobalStatisticsSqlDataSource">
        <ItemTemplate>
        
            <table cellpadding="5">
                <tr>
                    <td>
                        <asp:Label ID="NumPostsTitleLabel" runat="server" Text="<%$ Resources:Resource, ForumHomePage_NumPostsTitleLabel %>"
                            SkinID="InfoLabel"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="NumPostsLabel" runat="server" Text='<%# Eval("[NumPosts]") %>' SkinID="InfoLabel" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="NumUsersTitleLabel" runat="server" Text="<%$ Resources:Resource, ForumHomePage_NumUsersTitleLabel %>"
                            SkinID="InfoLabel"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="NumUsersLabel" runat="server" Text='<%# Bind("NumUsers") %>' SkinID="InfoLabel" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="PostsLastDayTitleLabel" runat="server" Text="<%$ Resources:Resource, ForumHomePage_PostsLastDayTitleLabel %>"
                            SkinID="InfoLabel"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="PostsLastDayLabel" runat="server" Text='<%# Bind("PostsLastDay") %>'
                            SkinID="InfoLabel" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="NumPrivateForumsTitleLabel" runat="server" Text="<%$ Resources:Resource, ForumHomePage_NumPrivateForumsTitleLabel %>"
                            SkinID="InfoLabel"></asp:Label>
                    </td>
                    <td>
                        <asp:Label ID="NumPrivateForumsLabel" runat="server" Text='<%# Bind("NumPrivateForums") %>'
                            SkinID="InfoLabel" />
                    </td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:FormView>
    <asp:SqlDataSource ID="ForumGlobalStatisticsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ForumGetGlobalStatistics" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <br />
    &nbsp;&nbsp;&nbsp;&nbsp;
    <asp:HyperLink ID="CreateNewPrivateForum" NavigateUrl="~/CreatePrivateForum.aspx"
        Visible="false" runat="server" Text="<%$ Resources:Resource, ForumHomePage_CreateNewPrivateForum %>"
        SkinID="GreenTitleHyperLink"></asp:HyperLink>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <asp:HyperLink ID="MyConversationsHyperLink" NavigateUrl="~/ForumConversations.aspx"
        Text="<%$ Resources:Resource, Global_MyConversations %>" runat="server" SkinID="GreenTitleHyperLink" Visible = ></asp:HyperLink>
      <asp:Button ID="MarkAllAsReadButton" runat="server" Text="<%$ Resources:Resource, Global_MarkAllAsRead %>"
        CssClass="GreenSmallButtonStyle antifloater" OnClientClick='return confirm(this.getAttribute("message"))'
        OnClick="MarkAllAsRead" message="<%$ Resources:Resource, ForumHomePage_MarkAllAsReadOnClientClick %>" />
    <div class="clearBoth"></div>
    </div>
    </div>        
    <div class="basic_element">
    <div class="red_title">
       <asp:Label ID="MyForumsLabel" runat="server" Text="<%$ Resources:Resource, ForumHomePage_MyForumsLabel %>" CssClass="white_title"></asp:Label>
    </div>
    <div class="padding5">

    <asp:GridView ID="GetUserForumsGridView" AutoGenerateColumns="False" DataSourceID="GetUserForumsSqlDataSource"
        runat="server" 
        SkinID="FrumGrid">
        <PagerSettings FirstPageText="<%$ Resources:Resource, FirstPage %>" LastPageText="<%$ Resources:Resource, LastPage %>"
            Mode="NumericFirstLast" PageButtonCount="10" Position="Bottom" />
        <PagerStyle CssClass="pagination" HorizontalAlign="Center" />
        <Columns>
            <asp:TemplateField ItemStyle-Width="50%">
                <HeaderTemplate>
                    <asp:Label ID="ForumNameLabel" runat="server" Text="<%$ Resources:Resource, Global_ForumName %>"></asp:Label>
                </HeaderTemplate>
                <ItemTemplate>
                    &nbsp;&nbsp;&nbsp;
                    <asp:Image ID="PublicPrivateImage" runat="server" ImageUrl='<%# Eval("PublicEnglishString", "~/Images/{0}.png") %>'
                        ToolTip='<%# Eval("PublicString")%>' />
                    &nbsp;&nbsp;&nbsp;
                    <asp:HyperLink ID="ForumNameHyperLink" runat="server" Text='<%# Eval("ForumName") %>'
                        NavigateUrl='<%# Eval("ForumId", "ForumDetails.aspx?Id={0}") %>' SkinID="BlackHyperLinkSkin"></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, ForumHomePage_ThreadsHeaderText %>"
                ItemStyle-Width="12%">
                <ItemTemplate>
                    &nbsp;
                    <asp:Label ID="NumUnreadThreads" runat="server" Text='<%# Eval("UnreadThreads") + " /" %>'
                        SkinID="GreenGridLabel" Visible='<%# IsNotZero(Eval("UnreadThreads").ToString()) %>'></asp:Label>
                    <asp:Label ID="NumThreadsLabel" runat="server" Text='<%# Eval("NumThreads") %>' SkinID="GridLabel"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, ForumHomePage_PostsHeaderText %>"
                ItemStyle-Width="12%">
                <ItemTemplate>
                    &nbsp;
                    <asp:Label ID="NumUnreadPostsLabel" runat="server" Text='<%# Eval("NumUnreadPosts", "{0} /")%>'
                        Visible='<%# IsNotZero(Eval("NumUnreadPosts").ToString()) %>' SkinID="GreenGridLabel"
                        ToolTip='<%# Eval("NumUnreadPosts", "{0} unread posts") %>'> </asp:Label>
                    <asp:Label ID="NumberOfPostsLabel" runat="server" Text='<%# Eval("NumberOfPosts")%>'
                        SkinID="GridLabel"> </asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="<%$ Resources:Resource, Global_LastPost %>" ItemStyle-Width="26%">
                <ItemTemplate>
                    &nbsp;
                    <asp:Label ID="ByLabel" runat="server" Text="<%$ Resources:Resource, Global_By %>"
                        SkinID="GridLabel"></asp:Label>
                    <asp:HyperLink ID="LastPostHyperLink" runat="server" Text='<%# Eval("LastPostUserName") %>'
                        NavigateUrl='<%# Eval("LastPostUserId", "UserPage.aspx?Id={0}") %>' SkinID="BlackHyperLinkSkin"></asp:HyperLink>
                    <br />
                    &nbsp;
                    <asp:Label ID="LastPostDateLabel" runat="server" Text='<%# Eval("LastPostDate")%>'
                        SkinID="GridLabel"> </asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <asp:Label ID="NoForumsWereMarkedLabel" runat="server" Text="<%$ Resources:Resource, ForumHomePage_NoForumsWereMarkedLabel %>"></asp:Label>
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="GetUserForumsSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ForumGetUserForums" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <br />
    
    <asp:Label ID="ErrorLabel" runat="server" Text="" SkinID="ErrorLabel"></asp:Label>
    <br />

    <asp:Panel ID = "SearchForumPanel" runat="server">
        <asp:Label ID="ForumSearchTitleLabel" runat="server" Text="<%$ Resources:Resource, ForumHomePage_ForumSearchTitleLabel %>"
            SkinID="InfoLabel"></asp:Label>
                                                                                                                                                                                <table cellspacing="3">
        <tr>
            <td>
                <asp:Label ID="ForumIdLabel" runat="server" Text="<%$ Resources:Resource, Global_ForumId %>"
                    SkinID="InfoLabel"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="ForumIdTextBox" runat="server" MaxLength="12" ValidationGroup="ForumSearch"
                    Width="150px"></asp:TextBox>
            </td>
            <td>
                <asp:Button ID="ForumIdButton" runat="server" ValidationGroup="ForumSearch" Text="<%$ Resources:Resource, Global_Search %>"
                    OnClick="ForumId_Click" CssClass="GreenButtonTextStyle" />
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator1" ControlToValidate="ForumIdTextBox"
                    ErrorMessage="Illigal Forum Id" ValidationExpression="^[0-9]{1,128}$" ValidationGroup="NameSearch"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="ForumNameTitleLabel" runat="server" Text="<%$ Resources:Resource, Global_ForumName %>"
                    SkinID="InfoLabel"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="ForumNameTextBox" runat="server" MaxLength="256" ValidationGroup="ForumNameSearch"
                    Width="150"></asp:TextBox>
            </td>
            <td valign="bottom">
                <asp:Button ID="ForumNameButton" runat="server" ValidationGroup="ForumSearch" Text="<%$ Resources:Resource, Global_Search %>"
                    OnClick="ForumName_Click" CssClass="GreenButtonTextStyle" />
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator3" ControlToValidate="ForumNameTextBox"
                    ErrorMessage="<%$ Resources:Resource, ForumHomePage_ErrorMessageValidator3 %>"
                    ValidationExpression="^[\s0-9a-zA-Z]{2,256}$" ValidationGroup="ForumSearch"></asp:RegularExpressionValidator>
            </td>
        </tr>
    </table>

    <asp:GridView ID="SearchForumByIdGridView" runat="server" DataSourceID="SearchForumByIdSqlDataSource"
        SkinID="Professional" AutoGenerateColumns="False" AllowPaging="True" Font-Size="13px"
        Visible="false" EnableTheming="True">
        <PagerSettings FirstPageText="<%$ Resources:Resource, FirstPage %>" LastPageText="<%$ Resources:Resource, LastPage %>"
            Mode="NumericFirstLast" PageButtonCount="10" Position="Bottom" />
        <PagerStyle CssClass="pagination" HorizontalAlign="Center" />
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    <asp:Label ID="ForumLabel" runat="server" Text="<%$ Resources:Resource, Global_Forum %>"></asp:Label>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="ForumDetailsHyperLink" runat="server" Text='<%# Eval("ForumName") %>'
                        NavigateUrl='<%# Eval("ForumId", "ForumDetails.aspx?Id={0}") %>' SkinID="BlackHyperLinkSkin"></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <asp:TextBox ID="TextBox1" Text="<%$ Resources:Resource, Global_Forum %>" runat="server"></asp:TextBox>
            <asp:Label ID="NoForumsFoundLabel" runat="server" Text="<%$ Resources:Resource, ForumHomePage_NoForumsFoundLabel %>"></asp:Label>
        </EmptyDataTemplate>
    </asp:GridView>

    <asp:GridView ID="SearchForumByNameGridView" runat="server" DataSourceID="SearchForumByNameSqlDataSource"
        SkinID="Professional" AutoGenerateColumns="False" AllowPaging="True" Visible="false"
        Font-Size="13px" EnableTheming="True">
        <PagerSettings FirstPageText="<%$ Resources:Resource, FirstPage %>" LastPageText="<%$ Resources:Resource, LastPage %>"
            Mode="NumericFirstLast" PageButtonCount="10" Position="Bottom" />
        <PagerStyle CssClass="pagination" HorizontalAlign="Center" />
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    <asp:Label ID="ForumNamesLabel" runat="server" Text="<%$ Resources:Resource, Global_Forum %>"></asp:Label>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="ForumNameHyperLink" runat="server" Text='<%# Eval("ForumName") %>'
                        NavigateUrl='<%# Eval("ForumId", "ForumDetails.aspx?Id={0}") %>' SkinID="BlackHyperLinkSkin"></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <asp:Label ID="NoForumWereFoundLabel" runat="server" Text="<%$ Resources:Resource, ForumHomePage_NoForumWereFoundLabel %>"></asp:Label>
        </EmptyDataTemplate>
    </asp:GridView>

        <asp:SqlDataSource ID="SearchForumByIdSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_ForumSearchById" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
        
        
        <asp:SqlDataSource ID="SearchForumByNameSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_ForumSearchByName" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>
    </asp:Panel>
    </div>
    </div>
    </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
